<html>
    <head>
    <link rel="stylesheet" href="lmm.css" type="text/css" />
    </head>
<body class="lmm">
<!-- This file is part of the Lisp Machine Manual 		-*-Text-*- -->

<div class='chapter'>4. Subprimitives</div><p class='cindent'><!-- subprimitives -->
	Subprimitives are functions which are not intended to be used by
the average program, only by "system programs".  They allow one to
manipulate the environment at a level lower than normal Lisp.
Subprimitives usually have names which start with a <font class="lisp">%</font> character.
The "primitives" described in other sections of the manual typically
use subprimitives to accomplish their work.  The subprimitives take
the place of machine language in other systems, to some extent.
Subprimitives are normally hand-coded in microcode.
	Subprimitives by their very nature cannot do full checking.
Improper use of subprimitives can destroy the environment.

<div class='section'>4.1 Data Types</div>
<div class='defun'><font class='exdent'><font class='funcname'>data-type <font class='italic' color='purple'>arg</font></font></font><br>
<font class="lisp">data-type</font> returns a symbol which is the name
for the internal data-type of the "pointer" which represents <font class="italic">arg</font>.
Note that some types as seen by the user are not distinguished from each other
at this level, and some user types may be represented by more than one
internal type.

.table 3
.item si:dtp-symbol
The object is a symbol.
.item si:dtp-fix
The object is a fixnum; the numeric value is contained immediately in the pointer field.
.item si:dtp-small-flonum
The object is an immediate small floating-point number.
.item si:dtp-extended-number
The object is a flonum or a bignum.  This value will be used for future numeric
types.
.item si:dtp-list
The object is a cons.
.item si:dtp-locative
The object is a locative pointer.
.item si:dtp-array-pointer
The object is an array.
.item si:dtp-fef-pointer
The object is a fef.
.item si:dtp-u-entry
The object is a microcode entry.
.item si:dtp-closure
The object is a closure.
.item si:dtp-stack-group
The object is a stack-group.
.item si:dtp-instance
The object is an "active object".  These are not documented yet.
.item si:dtp-entity
The same as <font class="lisp">dtp-closure</font> except it is a kind of "active object".
These are not documented yet.
.item si:dtp-select-method
Another type associated with "active objects" and not documented yet.
.item si:dtp-header
An internal type used to mark the first word of a multi-word structure.
.item si:dtp-array-header
An internal type used in arrays.
.item si:dtp-symbol-header
An internal type used to mark the first word of a symbol.
.item si:dtp-instance-header
An internal type used to mark the first word of an instance.
.item si:dtp-null
Nothing to do with <font class="lisp">nil</font>.  This is used in unbound value and function cells.
.item si:dtp-trap
The zero data-type, which is not used.  This hopes to detect microcode errors.
.item si:dtp-free
This type is used to fill free storage, to catch wild references.
.item si:dtp-external-value-cell-pointer
An "invisible pointer" used for external value cells,
which are part of the closure mechanism (see (closure)).
and used by compiled code to address value and function cells.
.item si:dtp-header-forward
An "invisible pointer" used to indicate that the structure containing
it has been moved elsewhere.  The "header word" of the structure is
replaced by one of these invisible pointers.  See the function <font class="lisp">structure-forward</font>
((structure-forward-fun)).
.item si:dtp-body-forward
An "invisible pointer" used to indicate that the structure containing
it has been moved elsewhere.  This points to the word containing
the header-forward, which points to the new copy of the structure.
.item si:dtp-one-q-forward
An "invisible pointer" used to indicate that the single cell containing
it has been moved elsewhere.
.item si:dtp-gc-forward
This is used by the copying garbage collector to flag old objects that
have already been copied.
.end_table
</div>

.defvar q-data-types
The value of <font class="lisp">q-data-types</font> is a list of all of the symbolic
names for data types described above under <font class="lisp">data-type</font>.
(the symbols whose print names begin
with "<font class="lisp">dtp-</font>")
.end_defvar

<div class='defun'><font class='exdent'><font class='funcname'>q-data-types <font class='italic' color='purple'>type-code</font></font></font><br>
An array, indexed by the internal numeric data-type code,
which contains the corresponding symbolic names.
</div>

<div class='section'>4.2 Creating Objects</div>
<div class='defun'><font class='exdent'><font class='funcname'>make-list <font class='italic' color='purple'>area size</font></font></font><br>
	This function makes a cdr-coded list of <font class="lisp">nil</font>s of a
specified length in a specified area.
<font class="italic">area</font> is which area to create it in, which may be either a fixnum
or a symbol whose value will be used.  <font class="italic">size</font> is the number
of words to be allocated.  Each word has cdr code <font class="italic">cdr-next</font>,
except for the last which has <font class="italic">cdr-nil</font>.
	This function is to be used only for making lists.  If
making a "structure" (any data type that has a header), use one
of the two functions below.  This is because the two classes of object
must be created in different storage regions, for the sake of
system storage conventions and the garbage collector.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%allocate-and-initialize <font class='italic' color='purple'>data-type header-type header second-word area size</font></font></font><br>
	This is the subprimitive for creating most structured-type objects.
<font class="italic">area</font> is the area in which it is to be created, as a fixnum or a symbol.
<font class="italic">size</font> is the number of words to be allocated.  The value returned
points to the first word allocated, and has data-type <font class="italic">data-type</font>.
Uninterruptibly, the words allocated are initialized so that storage
conventions are preserved at all times.  The first word, the header,
is initialized to have <font class="italic">header-type</font> in its data-type field 
and <font class="italic">header</font> in its pointer field.  The second word is initialized
to <font class="italic">second-word</font>.  The remaining words are initialized to <font class="lisp">nil</font>.
The cdr codes are initialized as in <font class="lisp">make-list</font>, currently.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%allocate-and-initialize-array <font class='italic' color='purple'>header data-length leader-length area size</font></font></font><br>
	This is the subprimitive for creating arrays, called only by <font class="lisp">make-array</font>.
It is different from <font class="lisp">%allocate-and-initialize</font> because arrays have
a more complicated header structure.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>structure-forward <font class='italic' color='purple'>old-object new-object</font></font></font><br>
This causes references to <font class="italic">old-object</font> to actually reference
<font class="italic">new-object</font>, by storing invisible pointers in <font class="italic">old-object</font>.
It returns <font class="italic">old-object</font>.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>forward-value-cell <font class='italic' color='purple'>from-symbol to-symbol</font></font></font><br>
This alters <font class="italic">from-symbol</font> so that it always has the same value
as <font class="italic">to-symbol</font>, by sharing its value cell.  A <font class="italic">one-q-forward</font>
invisible pointer is stored into <font class="italic">from-symbol</font>'s value cell.
Do not do this when <font class="italic">from-symbol</font> is <font class="lisp">lambda</font>-bound, as
the microcode does not bother to check for that case (doing so would
make binding slower).
</div>

<div class='section'>4.3 Pointer Manipulation</div>
	It should again be emphasized that improper use of these functions
can destroy the Lisp environment, primarily because of interactions
between the garbage collector and  the illegal pointers that
can be created by these sub-primitives.

<!-- Narrative description of Q format, and data types, or pointer thereto. -->

<div class='defun'><font class='exdent'><font class='funcname'>%data-type <font class='italic' color='purple'>x</font></font></font><br>
Returns the data-type field of <font class="italic">x</font>, as a fixnum.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%pointer <font class='italic' color='purple'>x</font></font></font><br>
Returns the pointer field of <font class="italic">x</font>, as a fixnum.  For most
types, this is dangerous since the garbage collector can copy the object
and change its address.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%make-pointer <font class='italic' color='purple'>data-type pointer</font></font></font><br>
This makes up a pointer, with <font class="italic">data-type</font> in the data-type
field and <font class="italic">pointer</font> in the pointer field, and returns it.  This is
most commonly used for changing the type of a pointer.  Do not use this
to make pointers which are not allowed to be in the machine, such as
<font class="lisp">dtp-null</font>, invisible pointers, etc.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%make-pointer-offset <font class='italic' color='purple'>data-type pointer offset</font></font></font><br>
This returns a pointer with <font class="italic">data-type</font> in the data-type
field, and <font class="italic">pointer</font> plus <font class="italic">offset</font> in the pointer field.  The
types of the arguments are not checked, their pointer fields are simply
added together.  This is useful for constructing locative pointers
into the middle of an object.  However, note that it is illegal to
have a pointer to untyped data, such as the inside of a FEF or
a numeric array.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%pointer-difference <font class='italic' color='purple'>pointer-1 pointer-2</font></font></font><br>
Returns a fixnum which is <font class="italic">pointer-1</font> minus <font class="italic">pointer-2</font>.
No type checks are made.  For the result to be meaningful, the two pointers
must point into the same object, so that their difference cannot change
as a result of garbage collection.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%find-structure-header <font class='italic' color='purple'>pointer</font></font></font><br>
This subprimitive finds the structure into which 
<font class="italic">pointer</font> points, by searching backward for a header.
It is a basic low-level function used by such things as the
garbage collector.
<font class="italic">pointer</font> is normally a locative, but its data-type is ignored.
Note that it is illegal to point into an "unboxed" portion of
a structure, for instance the middle of a numeric array.

In structure space, the "containing structure" of a pointer
is well-defined by system storage conventions.  In list space,
it is considered to be the contiguous, cdr-coded segment of
list surrounding the location pointed to.  If a cons of the list
has been copied out by <font class="lisp">rplacd</font>, the contiguous list includes
that pair and ends at that point.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%find-structure-leader <font class='italic' color='purple'>pointer</font></font></font><br>
This is identical to <font class="lisp">%find-structure-header</font>, except that if the
structure is an array with a leader, this returns a locative pointer
to the leader-header, rather than returning the array-pointer itself.
Thus the result of <font class="lisp">%find-structure-leader</font> is always the lowest
address in the structure.  This is the one used internally by the garbage collector.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%structure-boxed-size <font class='italic' color='purple'>object</font></font></font><br>
Returns the number of "boxed Q's" in <font class="italic">object</font>.  This is the number
of words at the front of the structure which contain normal Lisp objects.
Some structures, for example FEFs and numeric arrays, containing additional
"unboxed Q's" following their "boxed Q's".
Note that the boxed size of a PDL (either regular or special) does not
include Q's above the current top of the PDL.  These locations are boxed
but their contents is considered garbage, and is not protected by the
garbage collector.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%structure-total-size <font class='italic' color='purple'>object</font></font></font><br>
Returns the total number of words occupied by the representation
of <font class="italic">object</font>.
</div>

<div class='section'>4.4 Special Memory Referencing</div>
<div class='defun'><font class='exdent'><font class='funcname'>%store-conditional <font class='italic' color='purple'>pointer old new</font></font></font><br>
This is the basic locking primitive.  <font class="italic">pointer</font> points to
a cell which is uninterruptibly read and written.  If the contents of
the cell is <font class="lisp">eq</font> to <font class="italic">old</font>, then it is replaced by <font class="italic">new</font> and
<font class="lisp">t</font> is returned.  Otherwise, <font class="lisp">nil</font> is returned and the contents
of the cell is not changed.
</div>

The following four functions are for I/O programming.

<div class='defun'><font class='exdent'><font class='funcname'>%unibus-read <font class='italic' color='purple'>address</font></font></font><br>
Returns the contents of the register at the specified Unibus
address, as a fixnum.  You must specify a full 18-bit address.  This
is guaranteed to read the location only once.  Since the Lisp
Machine Unibus does not support byte operations, this always references
a 16-bit word, and so <font class="italic">address</font> will normally be an even number.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%unibus-write <font class='italic' color='purple'>address data</font></font></font><br>
Writes the 16-bit number <font class="italic">data</font> at the specified Unibus
address, exactly once.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%xbus-read <font class='italic' color='purple'>io-offset</font></font></font><br>
Returns a fixnum which is the low 24 bits of the contents
of the register at the specified Xbus address.  <font class="italic">io-offset</font> is
an offset into the I/O portion of Xbus physical address space.
This is guaranteed to read the location exactly once.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%xbus-write <font class='italic' color='purple'>io-offset data</font></font></font><br>
Writes the pointer field of <font class="italic">data</font>, which should be a fixnum,
into the register at the specified Xbus address.
The high eight bits of the word written are always zero.
<font class="italic">io-offset</font> is
an offset into the I/O portion of Xbus physical address space.
This is guaranteed to write the location exactly once.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-contents-offset <font class='italic' color='purple'>base-pointer offset</font></font></font><br>
This checks the cell pointed to by <font class="italic">base-pointer</font> for
a forwarding pointer.  Having followed forwarding pointers to the
real structure pointed to, it adds <font class="italic">offset</font> to the resulting
forwarded <font class="italic">base-pointer</font> and returns the contents of that location.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-contents-as-locative <font class='italic' color='purple'>pointer</font></font></font><br>
Given a pointer to a memory location containing a pointer which isn't
allowed to be "in the machine" (typically an invisible pointer)
this function returns the contents of the location as a <font class="lisp">dtp-locative</font>.  I.e.
it changes the disallowed data type to locative so that you can safely
look at it and see what it points to.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-contents-as-locative-offset <font class='italic' color='purple'>base-pointer offset</font></font></font><br>
This checks the cell pointed to by <font class="italic">base-pointer</font> for
a forwarding pointer.  Having followed forwarding pointers to the
real structure pointed to, it adds <font class="italic">offset</font> to the resulting
forwarded <font class="italic">base-pointer</font>, fetches the contents of that location,
and returns it with the data type changed to <font class="lisp">dtp-locative</font> in case
it was a type which isn't allowed to be "in the machine" (typically
an invisible pointer).  This is used, for example, to analyze the
<font class="lisp">dtp-external-value-cell-pointer</font> pointers in a FEF, which are
used by the compiled code to reference value cells and function cells
of symbols.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-store-contents <font class='italic' color='purple'>pointer value</font></font></font><br>
<font class="italic">value</font> is stored into the data-type and pointer
fields of the location addressed by <font class="italic">pointer</font>.  The cdr-code
and flag-bit fields remain unchanged.  <font class="italic">value</font> is returned.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-store-contents-offset <font class='italic' color='purple'>value base-pointer offset</font></font></font><br>
This checks the cell pointed to by <font class="italic">base-pointer</font> for
a forwarding pointer.  Having followed forwarding pointers to the
real structure pointed to, it adds <font class="italic">offset</font> to the resulting
forwarded <font class="italic">base-pointer</font>, and stores <font class="italic">value</font> into the data-type and pointer
fields of that location.  The cdr-code
and flag-bit fields remain unchanged.  <font class="italic">value</font> is returned.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-store-tag-and-pointer <font class='italic' color='purple'>pointer miscfields pntrfield</font></font></font><br>
Creates a <font class="italic">Q</font> by taking 8 bits from <font class="italic">miscfields</font>
and 24 bits from <font class="italic">pntrfield</font>, and stores that into the
location addressed by <font class="italic">pointer</font>.  The low 5 bits of <font class="italic">miscfields</font>
become the data-type, the next bit becomes the flag-bit, and the
top two bits become the cdr-code.  This is a good
way to store a forwarding pointer from one structure
to another (for example).
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-ldb <font class='italic' color='purple'>ppss pointer</font></font></font><br>
This is like <font class="lisp">ldb</font> but gets a byte from the location
addressed by <font class="italic">pointer</font>.  Note that
you can load bytes out of the data type etc. bits, not just
the pointer field, and that the word loaded out of need not
be a fixnum.  The result returned is always a fixnum, unlike
<font class="lisp">%p-contents</font> and friends.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-ldb-offset <font class='italic' color='purple'>ppss base-pointer offset</font></font></font><br>
This checks the cell pointed to by <font class="italic">base-pointer</font> for
a forwarding pointer.  Having followed forwarding pointers to the
real structure pointed to, the byte specified by <font class="italic">ppss</font> is
loaded from the contents of the location addressed by the forwarded
<font class="italic">base-pointer</font> plus <font class="italic">offset</font>, and returned as a fixnum.
This is the way to reference byte fields within a structure
without violating system storage conventions.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-dpb <font class='italic' color='purple'>value ppss pointer</font></font></font><br>
The <font class="italic">value</font>, a fixnum, is stored into the byte selected
by <font class="italic">ppss</font> in the word addressed by <font class="italic">pointer</font>.  <font class="lisp">nil</font> is returned.
You can use this to alter data types, cdr codes, etc.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-dpb-offset <font class='italic' color='purple'>value ppss base-pointer offset</font></font></font><br>
This checks the cell pointed to by <font class="italic">base-pointer</font> for
a forwarding pointer.  Having followed forwarding pointers to the
real structure pointed to, the <font class="italic">value</font> is stored into the byte specified by <font class="italic">ppss</font> in
the location addressed by the forwarded
<font class="italic">base-pointer</font> plus <font class="italic">offset</font>.  <font class="lisp">nil</font> is returned.
This is the way to alter unboxed data within a structure
without violating system storage conventions.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-mask-field <font class='italic' color='purple'>ppss pointer</font></font></font><br>
This is similar to <font class="lisp">%p-ldb</font>, except that the selected
byte is returned in its original position within the word instead
of right-aligned.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-mask-field-offset <font class='italic' color='purple'>ppss base-pointer offset</font></font></font><br>
This is similar to <font class="lisp">%p-ldb-offset</font>, except that the selected
byte is returned in its original position within the word instead
of right-aligned.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-deposit-field <font class='italic' color='purple'>value ppss pointer</font></font></font><br>
This is similar to <font class="lisp">%p-dpb</font>, except that the selected
byte is stored from the corresponding bits of <font class="italic">value</font> rather than
the right-aligned bits.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-deposit-field-offset <font class='italic' color='purple'>value ppss base-pointer offset</font></font></font><br>
This is similar to <font class="lisp">%p-dpb-offset</font>, except that the selected
byte is stored from the corresponding bits of <font class="italic">value</font> rather than
the right-aligned bits.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-pointer <font class='italic' color='purple'>pointer</font></font></font><br>
Extracts the pointer field of the contents of the
location addressed by <font class="italic">pointer</font> and returns
it as a fixnum.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-data-type <font class='italic' color='purple'>pointer</font></font></font><br>
Extracts the data-type field of the contents of the
location addressed by <font class="italic">pointer</font> and returns
it as a fixnum.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-cdr-code <font class='italic' color='purple'>pointer</font></font></font><br>
Extracts the cdr-code field of the contents of the
location addressed by <font class="italic">pointer</font> and returns
it as a fixnum.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-flag-bit <font class='italic' color='purple'>pointer</font></font></font><br>
Extracts the flag-bit field of the contents of the
location addressed by <font class="italic">pointer</font> and returns
it as a fixnum.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-store-pointer <font class='italic' color='purple'>pointer value</font></font></font><br>
Clobbers the pointer field of the location
addressed by <font class="italic">pointer</font> to <font class="italic">value</font>, and returns <font class="italic">value</font>.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-store-data-type <font class='italic' color='purple'>pointer value</font></font></font><br>
Clobbers the data-type field of the location
addressed by <font class="italic">pointer</font> to <font class="italic">value</font>, and returns <font class="italic">value</font>.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-store-cdr-code <font class='italic' color='purple'>pointer value</font></font></font><br>
Clobbers the cdr-code field of the location
addressed by <font class="italic">pointer</font> to <font class="italic">value</font>, and returns <font class="italic">value</font>.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%p-store-flag-bit <font class='italic' color='purple'>pointer value</font></font></font><br>
Clobbers the flag-bit field of the location
addressed by <font class="italic">pointer</font> to <font class="italic">value</font>, and returns <font class="italic">value</font>.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%stack-frame-pointer
Returns <font class='italic' color='purple'>a locative pointer to its caller's stack frame.  This</font></font></font><br>
function is not defined in the interpreted Lisp environment; it only works
from compiled code.  Since it turns into a "misc" instruction,
the "caller's stack frame" really means "the frame for the FEF
that executed the <font class="lisp">%stack-frame-pointer</font> instruction".
</div>

<div class='defun'><font class='exdent'><font class='funcname'>bind <font class='italic' color='purple'>locative value</font></font></font><br>
[This will be renamed to <font class="lisp">%bind</font> in the future.]
Binds the cell pointed to by <font class="italic">locative</font> to <font class="italic">x</font>, in
the caller's environment. This
function is not defined in the interpreted Lisp environment; it only works
from compiled code.  Since it turns into an instruction,
the "caller's environment" really means "the binding block for the FEF
that executed the <font class="lisp">bind</font> instruction".
</div>

<div class='defun'><font class='exdent'><font class='funcname'>%halt
Stops <font class='italic' color='purple'>the machine.</font></font></font><br>
</div>

<div class='section'>4.5 The Paging System</div>
<!-- Insert narrative description of the page hash table, etc. -->

[Someday this will discuss how it works.]

<div class='defun'><font class='exdent'><font class='funcname'>si:wire-page <font class='italic' color='purple'>address &optional (wire-p <font class="lisp">t</font>)</font></font></font><br>
If <font class="italic">wire-p</font> is <font class="lisp">t</font>, the page containing <font class="italic">address</font> is <font class="italic">wired-down</font>; that is,
it cannot be paged-out.  If <font class="italic">wire-p</font> is <font class="lisp">nil</font>, the page ceases to be wired-down.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>si:unwire-page <font class='italic' color='purple'>address</font></font></font><br>
<font class="lisp">(si:unwire-page <font class="italic">address</font>)</font> is the same as <font class="lisp">(si:wire-page <font class="italic">address</font>)</font>.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>si:%change-page-status <font class='italic' color='purple'>virtual-address swap-status access-status-and-meta-bits</font></font></font><br>
The page hash table entry for the page containing <font class="italic">virtual-address</font>
is found and altered as specified.  <font class="lisp">t</font> is returned if it was found,
<font class="lisp">nil</font> if it was not (presumably the page is swapped out.)  <font class="italic">swap-status</font>
and <font class="italic">access-status-and-meta-bits</font> can be <font class="lisp">nil</font> if those fields are not
to be changed.  This doesn't make any error checks; you can really
screw things up if you call it with the wrong arguments.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>si:%compute-page-hash <font class='italic' color='purple'>virtual-address</font></font></font><br>
This makes the hashing function for the page hash table
available to the user.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>si:%create-physical-page <font class='italic' color='purple'>physical-address</font></font></font><br>
This is used when adjusting the size of real memory available
to the machine.  It adds an entry for the page frame at <font class="italic">physical-address</font>
to the page hash table, with virtual address -1, swap status flushable,
and map status 120 (read only).  This doesn't make error checks; you
can really screw things up if you call it with the wrong arguments.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>si:%delete-physical-page <font class='italic' color='purple'>physical-address</font></font></font><br>
If there is a page in the page frame at <font class="italic">physical-address</font>,
it is swapped out and its entry is deleted from the page hash table,
making that page frame unavailable for swapping in of pages in the
future.  This doesn't make error checks; you
can really screw things up if you call it with the wrong arguments.
</div>

<div class='defun'><font class='exdent'><font class='funcname'>si:%disk-restore <font class='italic' color='purple'>high-16-bits low-16-bits</font></font></font><br>
Loads virtual memory from the partition named by the catenation of
the two 16-bit arguments, and starts executing it.  The name <font class="lisp">0</font>
refers to the default load (the one the machine loads when it is
started up).
</div>

<div class='defun'><font class='exdent'><font class='funcname'>si:%disk-save <font class='italic' color='purple'>physical-mem-size high-16-bits low-16-bits</font></font></font><br>
Copies virtual memory into the partition named by the catenation
of the two 16-bit arguments (<font class="lisp">0</font> means the default), then restarts
the world, as if it had just been restored.  The <font class="italic">physical-mem-size</font>
argument should come from <font class="lisp">%sys-com-memory-size</font> in <font class="lisp">system-communication-area</font>.
</div>

<div class='section'>4.6 The Paging System</div>
The following variables' values actually reside in the scratchpad memory
of the processor.  They are put there by <font class="lisp">dtp-one-q-forward</font> invisible
pointers.  The values of these variables are used by the microcode.

.defvar %microcode-version-number
This is the version number of the currently-loaded microcode, obtained
from the version number of the microcode source file.
.end_defvar

.defvar sys:%number-of-micro-entries
Size of <font class="lisp">micro-code-entry-area</font> and related areas.  Currently the
data-type is missing from this number.
.end_defvar

.defvar default-cons-area
The area number of the default area in which new data are to be consed.
This is normally <font class="lisp">working-storage-area</font>.
.end_defvar
	
.defvar si:%initial-fef
The function which is called when the machine starts up.
Normally <font class="lisp">si:lisp-top-level</font>.
.end_defvar

.defvar %error-handler-stack-group
The stack group which receives control when a microcode-detected error
occurs.  This stack group cleans up, signals the appropriate condition,
or enters the debugger.
.end_defvar

.defvar si:%current-stack-group
The stack group which is currently running.
.end_defvar

.defvar %initial-stack-group
The stack group in which the machine starts up.
.end_defvar

.defvar si:%current-stack-group-state
The <font class="lisp">sg-state</font> of the currently-running stack group.
.end_defvar

.defvar si:%current-stack-group-previous-stack-group
The resumer of the currently-running stack group.
.end_defvar

.defvar si:%current-stack-group-calling-args-pointer
The argument list of the currently-running stack group.
.end_defvar

.defvar si:%current-stack-group-calling-args-number
The number of arguments to the currently-running stack group.
.end_defvar

.defvar si:%trap-micro-pc
The microcode address of the most recent error trap.
.end_defvar

.defvar si:%count-first-level-map-reloads
The number of times the first-level virtual-memory map was invalid
and had to be reloaded from the page hash table.
.end_defvar

.defvar si:%count-second-level-map-reloads
The number of times the second-level virtual-memory map was invalid
and had to be reloaded from the page hash table.
.end_defvar

.defvar si:%count-pdl-buffer-read-faults
The number of read references to the pdl buffer which happened
as virtual memory references which trapped.
.end_defvar

.defvar si:%count-pdl-buffer-write-faults
The number of read references to the pdl buffer which happened
as virtual memory references which trapped.
.end_defvar

.defvar si:%count-pdl-buffer-memory-faults
The number of virtual memory references which trapped in case
they should have gone to the pdl buffer, but turned out to be
real memory references after all (and therefore were needlessly
slowed down.)
.end_defvar

.defvar si:%count-disk-page-reads
The number of pages read from the disk.
.end_defvar

.defvar si:%count-disk-page-writes
The number of pages written to the disk.
.end_defvar

.defvar si:%count-disk-errors
The number of recoverable disk errors.
.end_defvar

.defvar si:%count-fresh-pages
The number of fresh (newly-consed) pages created in core,
which would have otherwise been read from the disk.
.end_defvar

.defvar si:%aging-rate
The number of age steps per disk read or write.  This parameter
controls how long a page must remain unreferenced before it is
evicted from main memory.
.end_defvar

.defvar si:%count-aged-pages
The number of times the page ager set an age trap on a page, to determine
whether it was being referenced.
.end_defvar

.defvar si:%count-age-flushed-pages
The number of times the page ager saw that a page still had an age trap
and hence made it "flushable", a candidate for eviction from main memory.
.end_defvar

.defvar %mar-low
A fixnum which is the inclusive lower bound of the region of virtual
memory subject to the MAR feature.
.end_defvar

.defvar %mar-high
A fixnum which is the inclusive upper bound of the region of virtual
memory subject to the MAR feature.
.end_defvar

.defvar %self
The instance which has just been called.  (See (instance).)
.end_defvar

.defvar %method-class
The class in which the current method was found.  (See (method).)
.end_defvar

.defvar inhibit-scheduling-flag
If non-<font class="lisp">nil</font>, no process other than the current process can
run.
.end_defvar

.defvar inhibit-scavenging-flag
If non-<font class="lisp">nil</font>, the scavenger is turned off.  The scavenger is
the quasi-asynchronous portion of the garbage collector,
which normally runs during consing operations.
.end_defvar
.eof
&lt;/body&gt;
&lt;/html&gt;

